import java.awt.Color;
import java.awt.Component;

import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

public class StatusTableCellRenderer extends DefaultTableCellRenderer
{
	@Override
	public Component getTableCellRendererComponent(JTable table, Object value,
			boolean isSelected, boolean hasFocus, int row, int column) 
	{
		super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
		boolean isAlive = ((TableModel)(table.getModel())).getRow(row).getIsAlive();
		
        if(isAlive)
        {
        	if(!isSelected)
        		setBackground(Color.WHITE);
        }
        else
        {
        	if(!isSelected)
        		setBackground(Color.RED);
        }
		
		return this;
	}

}
